package com.pospi.xstore.ui.pay_ui;

import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

import com.lany.sp.SPHelper;
import com.pospi.xstore.R;
import com.pospi.xstore.ui.base.BaseActivity;
import com.pospi.xstore.ui.cash_ui.ScanReceiptActivity;
import com.pospi.xstore.util.Constant;
import com.pospi.xstore.util.PareseJson;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class PaySuccessActivity extends BaseActivity {

    @Bind(R.id.tv_payment)
    TextView tvPayment;//支付方式
    @Bind(R.id.tv_pay_money)
    TextView tvPayMoney;
    @Bind(R.id.tv_change)
    TextView tvChange;
    @Bind(R.id.tv_order_id)
    TextView tvOrderId;
    @Bind(R.id.tv_shop_name)
    TextView tvShopName;
    @Bind(R.id.tv_cashier)
    TextView tvCashier;
    @Bind(R.id.btn_back)
    Button btnBack;
    @Bind(R.id.tv_ss)
    TextView tvSs;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentLayout(R.layout.activity_pay_success);
        setTitle("结账成功");
        setBackVisible(false);
        ButterKnife.bind(this);

        int whichOne = getSharedPreferences("islogin", MODE_PRIVATE).getInt("which", 0);
        String cashier_name = "";

        String shopName = SPHelper.getInstance().getString(Constant.STORE_NAME);

        String payway = getIntent().getStringExtra(PayActivity.PUT_PAYWAY);
        String maxNo = getIntent().getStringExtra(PayActivity.PUT_MAXNO);
        String zl = getIntent().getStringExtra(PayActivity.PUT_ZL);
        String ys = getIntent().getStringExtra(PayActivity.PUT_YS);
        String ss = getIntent().getStringExtra(PayActivity.PUT_SS);

        tvPayment.setText(payway);
        tvPayMoney.setText(ys);
        tvChange.setText(zl);
        tvCashier.setText(cashier_name);
        tvOrderId.setText(maxNo);
        tvShopName.setText(shopName);
        tvSs.setText(ss);

    }



    @OnClick(R.id.btn_back)
    public void onClick() {

        Intent intent = new Intent(this, ScanReceiptActivity.class);
        intent.putExtra("pay", "ok");
        startActivity(intent);
        finish();
    }
}
